<?php
session_start();
$id = $_POST['id_vehicle'];
if(in_array($id,$_SESSION['vehicle_comparative'])){
    $chave = array_search($id, $_SESSION['vehicle_comparative']);
    unset($_SESSION['vehicle_comparative'][$chave]);
    echo "remove";
}else{
    $_SESSION['vehicle_comparative'][] = $_POST['id_vehicle'];
    echo "add";
}
//echo var_dump($_SESSION['vehicle_comparative']);
?>
